<?php

add_action('init','woo_options');  
function woo_options(){
	
// VARIABLES
$themename = "Apz";
$manualurl = 'http://www.woothemes.com/support/theme-documentation/wf/';
$shortname = "woo";

$GLOBALS['template_path'] = get_bloginfo('template_directory');

//Access the WordPress Categories via an Array
$woo_categories = array();  
$woo_categories_obj = get_categories('hide_empty=0');
foreach ($woo_categories_obj as $woo_cat) {
    $woo_categories[$woo_cat->cat_ID] = $woo_cat->cat_name;}
$categories_tmp = array_unshift($woo_categories, "Select a category:");    
       
//Access the WordPress Pages via an Array
$woo_pages = array();
$woo_pages_obj = get_pages('sort_column=post_parent,menu_order');    
foreach ($woo_pages_obj as $woo_page) {
    $woo_pages[$woo_page->ID] = $woo_page->post_name; }
$woo_pages_tmp = array_unshift($woo_pages, "Select a page:");       

// Image Alignment radio box
$options_thumb_align = array("alignleft" => "Left","alignright" => "Right","aligncenter" => "Center"); 

//Testing 
$options_select = array("one","two","three","four","five");
$options_radio = array("one" => "One","two" => "Two","three" => "Three","four" => "Four","five" => "Five"); 

//Stylesheets Reader
$alt_stylesheet_path = TEMPLATEPATH . '/styles/';
$alt_stylesheets = array();

if ( is_dir($alt_stylesheet_path) ) {
    if ($alt_stylesheet_dir = opendir($alt_stylesheet_path) ) { 
        while ( ($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false ) {
            if(stristr($alt_stylesheet_file, ".css") !== false) {
                $alt_stylesheets[] = $alt_stylesheet_file;
            }
        }    
    }
}

//More Options
$all_uploads_path = get_bloginfo('home') . '/wp-content/uploads/';
$all_uploads = get_option('woo_uploads');
$other_entries = array("Select a number:","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19");

// THIS IS THE DIFFERENT FIELDS
$options = array();   

$options[] = array( "name" => "General Settings",
                    "type" => "heading");
                        
$options[] = array( "name" => "Theme Stylesheet",
					"desc" => "Select your themes alternative color scheme.",
					"id" => $shortname."_alt_stylesheet",
					"std" => "default.css",
					"type" => "select",
					"options" => $alt_stylesheets);

$options[] = array( "name" => "Custom Logo",
					"desc" => "Upload a logo for your theme, or specify the image address of your online logo. (http://yoursite.com/logo.png)",
					"id" => $shortname."_logo",
					"std" => "",
					"type" => "upload");    
                                                                                     
$options[] = array( "name" => "Text Title",
					"desc" => "Enable if you want Blog Title and Tagline to be text-based. Setup title/tagline in WP -> Settings -> General.",
					"id" => $shortname."_texttitle",
					"std" => "false",
					"type" => "checkbox");

$options[] = array( "name" => "Custom Favicon",
					"desc" => "Upload a 16px x 16px Png/Gif image that will represent your website's favicon.",
					"id" => $shortname."_custom_favicon",
					"std" => "",
					"type" => "upload"); 
                                               
$options[] = array( "name" => "Tracking Code",
					"desc" => "Paste your Google Analytics (or other) tracking code here. This will be added into the footer template of your theme.",
					"id" => $shortname."_google_analytics",
					"std" => "",
					"type" => "textarea");        

$options[] = array( "name" => "RSS URL",
					"desc" => "Enter your preferred RSS URL. (Feedburner or other)",
					"id" => $shortname."_feed_url",
					"std" => "",
					"type" => "text");
                    
$options[] = array( "name" => "E-Mail URL",
					"desc" => "Enter your preferred E-mail subscription URL. (Feedburner or other)",
					"id" => $shortname."_subscribe_email",
					"std" => "",
					"type" => "text");

$options[] = array( "name" => "Date Format",
					"desc" => "Date format to display in posts using <a href=\"http://www.php.net/date/\">PHP date parameters</a>.",
					"id" => $shortname."_date",
					"std" => "d. M, Y",
					"type" => "text");

$options[] = array( "name" => "Custom CSS",
                    "desc" => "Quickly add some CSS to your theme by adding it to this block.",
                    "id" => $shortname."_custom_css",
                    "std" => "",
                    "type" => "textarea");

$options[] = array( "name" => "Post/Page Comments",
					"desc" => "Select if you want to enable/disable comments on posts and/or pages. ",
					"id" => $shortname."_comments",
					"type" => "select2",
					"options" => array("post" => "Posts Only", "page" => "Pages Only", "both" => "Pages / Posts", "none" => "None") );                                                          
    
$options[] = array( "name" => "Styling Options",
					"type" => "heading");    

$options[] = array( "name" =>  "Link Color",
					"desc" => "Pick a custom color for links or add a hex color code e.g. #697e09",
					"id" => "woo_link_color",
					"std" => "",
					"type" => "color");   

$options[] = array( "name" =>  "Link Hover Color",
					"desc" => "Pick a custom color for links hover or add a hex color code e.g. #697e09",
					"id" => "woo_link_hover_color",
					"std" => "",
					"type" => "color");                    

$options[] = array( "name" =>  "Button Color",
					"desc" => "Pick a custom color for buttons or add a hex color code e.g. #697e09",
					"id" => "woo_button_color",
					"std" => "",
					"type" => "color");                    

$options[] = array( "name" => "Navigation Options",
					"type" => "heading");    

$options[] = array( "name" => "Category Navigation",
					"desc" => "Swap the Page navigation for a Category navigation. <br /><strong>Note: this does not affect Custom Navigation Menus.</strong> ",
					"id" => $shortname."_cat_menu",
					"std" => "false",
					"type" => "checkbox");    

$options[] = array( "name" => "Exclude Pages or Categories from Navigation",
					"desc" => "Enter a comma-separated list of <a href='http://support.wordpress.com/pages/8/'>ID's</a> that you'd like to exclude from the top navigation (e.g. 12,23,27,44). <br /><strong>Note: this does not affect Custom Navigation Menus.</strong>",
					"id" => $shortname."_nav_exclude",
					"std" => "",
					"type" => "text");
					
$options[] = array(	"name" => "Featured Slider",
					"type" => "heading");					

$options[] = array( "name" => "Disable Slider",
					"desc" => "Check this to disable the slider on the homepage.",
					"id" => $shortname."_slider_disable",
					"std" => "false",
					"type" => "checkbox");    

$options[] = array( "name" => "Disable iPhone Image",
					"desc" => "Check this to disable the iPhone image container in the slider on the homepage.",
					"id" => $shortname."_slider_iphone_disable",
					"std" => "false",
					"type" => "checkbox");    

$options[] = array(	"name" => "Featured Slider Pages",
					"desc" => "Enter a comma-separated list of the <a href='http://faq.wordpress.com/2008/05/29/how-to-find-page-id-numbers/'>page ID's</a> that you'd like to display in the featured slider. (ie. 1,2,3,4)",
					"id" => $shortname."_feat_pages",
					"std" => "",
					"type" => "text");

$options[] = array( "name" => "Featured Slider Height",
					"desc" => "Set a manual height for the slider e.g. 250. Default height is 500px. <br /><strong>Note: this only applies when there is only one slide.</strong>",
					"id" => $shortname."_apz_slider_height",
					"std" => "500",
					"type" => "text"); 

$options[] = array(	"name" => "Exclude From Navigation",
					"desc" => "Check this box if you wish to exclude the slider pages from the main navigation.",
					"id" => $shortname."_ex_feat_pages",
					"std" => "true",
					"type" => "checkbox");	
                    
$options[] = array(    "name" => "Animation Speed",
                    "desc" => "The time in <b>seconds</b> the animation between frames will take.",
                    "id" => $shortname."_slider_speed",
                    "std" => 0.6,
                    "type" => "text");

$options[] = array(    "name" => "Auto Start",
                    "desc" => "Set the slider to start sliding automatically.",
                    "id" => $shortname."_slider_auto",
                    "std" => "false",
                    "type" => "checkbox");   
                    
$options[] = array(    "name" => "Auto Slide Interval",
                    "desc" => "The time in <b>seconds</b> each slide pauses for, before sliding to the next.",
                    "id" => $shortname."_slider_interval",
                    "std" => 4.0,
                    "type" => "text");				
					 					                   
$options[] = array( "name" => "Featured Media",
				    "type" => "heading");    

$options[] = array( "name" => "Disable Featured Media",
					"desc" => "Check this to disable the featured media area on the homepage.",
					"id" => $shortname."_media_panel_disable",
					"std" => "false",
					"type" => "checkbox");  
					
$options[] = array( "name" => "Image Category",
					"desc" => "Select the category that you would like to use for images.",
					"id" => $shortname."_media_image_category",
					"std" => "Select a category:",
					"type" => "select",
					"options" => $woo_categories);
					
$options[] = array( "name" => "Video Category",
					"desc" => "Select the category that you would like to use for video.",
					"id" => $shortname."_media_video_category",
					"std" => "Select a category:",
					"type" => "select",
					"options" => $woo_categories); 

$options[] = array( "name" => "Exclude Category Posts from Blog",
					"desc" => "Exclude the above categories posts from the blog section on the homepage. ",
					"id" => $shortname."_blog_exclude_categories",
					"std" => "true",
					"type" => "checkbox");  
										
$options[] = array( "name" => "Widgets Panel",
				    "type" => "heading");
				    
$options[] = array( "name" => "Enable Widget Panel on the homepage",
					"desc" => "Show the widgets panel on the homepage.",
					"id" => $shortname."_widgets_footer_panel",
					"std" => "true",
					"type" => "checkbox"); 
					
$options[] = array(	"name" => "Widgets Panel Header",
					"desc" => ".",
					"id" => $shortname."_widgets_footer_panel_header",
					"std" => "Widgets",
					"type" => "text");

$options[] = array(	"name" => "Widgets Panel Description",
					"desc" => ".",
					"id" => $shortname."_widgets_footer_panel_description",
					"std" => "A space for your widgets",
					"type" => "text");
										               
$options[] = array( "name" => "Blog Panel",
				    "type" => "heading");   
				    
$options[] = array( "name" => "Enable Blog Panel on the homepage",
					"desc" => "Show the blog panel on the homepage.",
					"id" => $shortname."_blog_footer_panel",
					"std" => "true",
					"type" => "checkbox"); 

$options[] = array(	"name" => "Number of Blog Posts to display",
					"desc" => "The number of posts that will be displayed on the homepage",
					"id" => $shortname."_blog_number_of_posts",
					"std" => "3",
					"type" => "text");
										
$options[] = array(	"name" => "Blog Panel Header",
					"desc" => "This is the text that will be displayed on the homepage for the panel.",
					"id" => $shortname."_blog_footer_panel_header",
					"std" => "Blog",
					"type" => "text");

$options[] = array(	"name" => "Blog Panel Description",
					"desc" => "This is the text that will be displayed under the header on the homepage for the panel.",
					"id" => $shortname."_blog_footer_panel_description",
					"std" => "The latest news and info",
					"type" => "text");

$options[] = array( "name" => "Blog Page Template",
					"desc" => "Select the page that has the blog page template applied to.",
					"id" => $shortname."_blog_page_template",
					"std" => "Select a page:",
					"type" => "select",
					"options" => $woo_pages);
										
$options[] = array( "name" => "Contact Panel",
				    "type" => "heading");   
				    
$options[] = array( "name" => "Enable Contact Panel in the homepage footer",
					"desc" => "Show the contact panel in the footer of the homepage.",
					"id" => $shortname."_contact_footer_panel",
					"std" => "true",
					"type" => "checkbox"); 

$options[] = array(	"name" => "Contact Panel Header",
					"desc" => ".",
					"id" => $shortname."_contact_footer_panel_header",
					"std" => "Contact",
					"type" => "text");

$options[] = array(	"name" => "Contact Panel Description",
					"desc" => ".",
					"id" => $shortname."_contact_footer_panel_description",
					"std" => "Contact and follow us",
					"type" => "text");

$options[] = array( "name" => "Contact Form E-Mail",
					"desc" => "Enter your E-mail address to use on the Contact Form Page Template. Add the contact form by adding a new page and selecting 'Contact Form' as page template.",
					"id" => $shortname."_contactform_email",
					"std" => "",
					"type" => "text");

$options[] = array( "name" => "Contact Form Twitter Username",
					"desc" => "Enter your Twitter username to add a link to your Twitter profile on the contact form on the homepage.",
					"id" => $shortname."_contactform_twitter",
					"std" => "",
					"type" => "text");
									
$options[] = array( "name" => "Contact Form Facebook URL",
					"desc" => "Enter your Facebook Page URL to add a link to your Facebook Page on the contact form on the homepage.",
					"id" => $shortname."_contactform_facebook",
					"std" => "",
					"type" => "text");
															 					                   
$options[] = array( "name" => "Dynamic Images",
				    "type" => "heading");    

$options[] = array( "name" => "Enable Dynamic Image Resizer",
					"desc" => "This will enable the thumb.php script. It dynamicaly resizes images on your site.",
					"id" => $shortname."_resize",
					"std" => "true",
					"type" => "checkbox");    
                    
$options[] = array( "name" => "Automatic Image Thumbs",
					"desc" => "If no image is specified in the 'image' custom field then the first uploaded post image is used.",
					"id" => $shortname."_auto_img",
					"std" => "false",
					"type" => "checkbox");    

$options[] = array( "name" => "Thumbnail Image Dimensions",
					"desc" => "Enter an integer value i.e. 250 for the desired size which will be used when dynamically creating the images.",
					"id" => $shortname."_image_dimensions",
					"std" => "",
					"type" => array( 
									array(  'id' => $shortname. '_thumb_w',
											'type' => 'text',
											'std' => 100,
											'meta' => 'Width'),
									array(  'id' => $shortname. '_thumb_h',
											'type' => 'text',
											'std' => 100,
											'meta' => 'Height')
								  ));
                                                                                                
$options[] = array( "name" => "Thumbnail Image alignment",
					"desc" => "Select how to align your thumbnails with posts.",
					"id" => $shortname."_thumb_align",
					"std" => "alignleft",
					"type" => "radio",
					"options" => $options_thumb_align); 

$options[] = array( "name" => "Show thumbnail in Single Posts",
					"desc" => "Show the attached image in the single post page.",
					"id" => $shortname."_thumb_single",
					"std" => "false",
					"type" => "checkbox");    

$options[] = array( "name" => "Single Image Dimensions",
					"desc" => "Enter an integer value i.e. 250 for the image size. Max width is 576.",
					"id" => $shortname."_image_dimensions",
					"std" => "",
					"type" => array( 
									array(  'id' => $shortname. '_single_w',
											'type' => 'text',
											'std' => 200,
											'meta' => 'Width'),
									array(  'id' => $shortname. '_single_h',
											'type' => 'text',
											'std' => 200,
											'meta' => 'Height')
								  ));

$options[] = array( "name" => "Add thumbnail to RSS feed",
					"desc" => "Add the the image uploaded via your Custom Settings to your RSS feed",
					"id" => $shortname."_rss_thumb",
					"std" => "false",
					"type" => "checkbox");    

//Advertising       
                                              

update_option('woo_template',$options);      
update_option('woo_themename',$themename);   
update_option('woo_shortname',$shortname);
update_option('woo_manual',$manualurl);

                                     
// Woo Metabox Options
$woo_metaboxes = array(

        "image" => array (
            "name"  => "image",
            "std"  => "",
            "label" => "Custom Thumbnail Image",
            "type" => "upload",
            "desc" => "Upload an image to show with your post."
        ),
        "horizontal-slider" => array (
            "name"  => "horizontal-slider",
            "std"  => "false",
            "label" => "Use Horizontal Image",
            "type" => "checkbox",
            "desc" => "Use Horizontal Image for the Featured Slider on the homepage."
        ),
        "embed" => array (
            "name"  => "embed",
            "std"  => "",
            "label" => "Embed Code",
            "type" => "textarea",
            "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar)"
        ),
        "embed-width" => array (
            "name"  => "embed-width",
            "std"  => "",
            "label" => "Featured Video Width",
            "type" => "text",
            "desc" => "Enter the width for the homepage video embed code for your video (YouTube, Vimeo or similar)"
        ),
        "embed-height" => array (
            "name"  => "embed-height",
            "std"  => "",
            "label" => "Featured Video Height",
            "type" => "text",
            "desc" => "Enter the height for the homepage video embed code for your video (YouTube, Vimeo or similar)"
        ),
        "appstore-link" => array (
            "name"  => "appstore-link",
            "std"  => "http://",
            "label" => "Link to App Store",
            "type" => "text",
            "desc" => "Enter the link to the App Store for this App"
        )
    );

update_option('woo_custom_template',$woo_metaboxes);      

}

?>